import useAccountTokenUserInfoStore from '@/core/account/store/useAccountTokenUserInfoStore'

class PermissionManager {
	// 当前账户有任意一种权限
	hasAny = (permissions: string[]): boolean => {
		const userPermissions = this.getUserPermissions()
		return userPermissions.some(userPermission => {
			return permissions.includes(userPermission)
		})
	}

	private getUserPermissions() {
		return useAccountTokenUserInfoStore.getState()?.authorities || []
	}
}
const permissionManager = new PermissionManager()

export default permissionManager
